﻿using System;
using FluentNHibernate.Mapping;

namespace Data.Model
{
    [Serializable]
    public class ProfilBase
    {
        public virtual int ProfilId { get; set; }
        public virtual string ProfilLabel { get; set; }
    }
    public class Profil : ProfilBase
    {
        public virtual Iesi.Collections.Generic.ISet<User> Users { get; set; }
    }
    public class ProfilMap : ClassMap<Profil>
    {
        public ProfilMap()
        {
            Table("Profils");
            Schema("dbo");
            Id(x => x.ProfilId).GeneratedBy.Assigned();
            OptimisticLock.Version();
            Map(x => x.ProfilLabel);
            HasMany(x => x.Users).KeyColumn("ProfilId").Inverse().Fetch.Select().AsSet();
        }
    }
}
